/**
 ****************************************************************************************
 *
 * @file user.h
 *
 * @brief USER Service API
 *
 ****************************************************************************************/

#ifndef _CUSTOM_H_
#define _CUSTOM_H_

/*
 * INCLUDE FILES
 ****************************************************************************************
 */
#include "stdint.h"

/**
 * @defgroup CUSTOM_MACRO Defines
 * @{
 */
#define CUSTOM_CONNECTION_MAX         1
#define CUSTOM_MAX_DATA_LEN           20                                                   /**< Maximum length of CUSTOM characteristic. */

/** @} */

/**
 * @defgroup CUSTOM_ENUM Enumerations
 * @{
 */
/**@brief CUSTOM Service event type. */
typedef enum
{
    CUSTOM_EVT_INVALID,
    CUSTOM_EVT_INDICATION_ENABLED,
    CUSTOM_EVT_INDICATION_DISABLED,
    CUSTOM_EVT_INDICATION_COMPLETE,
    CUSTOM_EVT_RECEIVE_DATA,
} custom_evt_type_t;
/** @} */

/**
 * @defgroup CUSTOM_STRUCT Structures
 * @{
 */
/**@brief CUSTOM Service event. */
typedef struct
{
    uint8_t             evt_type;         /**< The CUSTOM event. */
    uint8_t             *p_data;          /**< Pointer to data. */
    uint16_t            length;           /**< Length of data. */
} custom_evt_t;
/** @} */

/**
 * @defgroup CUSTOM_TYPEDEF Typedefs
 * @{
 */
/**@brief CUSTOM Service event handler type. */
typedef void (*custom_evt_handler_t)(custom_evt_t *p_evt);

/**@brief CUSTOM Service function type. */
typedef  void (*function)(void);
/** @} */

/**
 * @defgroup CUSTOM_STRUCT Structures
 * @{
 */
/**@brief CUSTOM Service initialization variable. */
typedef struct
{
    custom_evt_handler_t evt_handler;    /**< Handler to handle CUSTOM event. */
} custom_profile_cb_t;
/** @} */


/**
 * @defgroup CUSTOM_FUNCTION Functions
 * @{
 */
/**
 *****************************************************************************************
 * @brief Add an CUSTOM Service instance in the DB
 *
 * @param[in] p_custom_init :Pointer to CUSTOM Service environment variable
 *
 * @return Result of service initialization.
 *****************************************************************************************
 */
int custom_service_init(custom_profile_cb_t *cb);


/**
 *****************************************************************************************
 * @brief Send data to peer device
 *
 * @param[in] p_data:   The Pointer of send value
 * @param[in] length:   The Lenth of send value
 *
 * @return Result of notify and indicate value 
 *****************************************************************************************
 */
int custom_indicate_data(uint8_t *p_data, uint16_t length);

void custom_set_profile_cb_evt(uint8_t evt_type);

/** @} */

#endif
/** @} */
/** @} */
